package com.software.myopiaparents.ui;


import android.content.Intent;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;


import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.ogaclejapan.smarttablayout.utils.v4.Bundler;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems;
import com.software.myopiaparents.R;
import com.software.myopiaparents.base.BaseActivity;
import com.software.myopiaparents.fragment.AlarmFragment;
import com.software.myopiaparents.utils.eb.EB;
import com.software.myopiaparents.utils.eb.EbData;

import butterknife.BindView;
import butterknife.OnClick;


/**
 * 警报提示
 *
 * @author penglei
 * @date 2020/05/13
 */
public class AlarmPromptActivity extends BaseActivity {
    private static final String TAG = "HelpActivity";

    @BindView(R.id.iv_title_left)
    ImageView mIvTitleLeft;
    @BindView(R.id.tv_title_text)
    TextView mTvTitleText;
    @BindView(R.id.tv_title_right)
    TextView mTvTitleRight;
    @BindView(R.id.lay_title_home)
    LinearLayout mLayTitleHome;

    @BindView(R.id.tab_view)
    SmartTabLayout mTabView;
    @BindView(R.id.vp_pager)
    ViewPager mVpPager;


    @Override
    protected int getContentViewId() {
        return R.layout.activity_alarm_prompt;
    }

    @Override
    public void initView() {
        mTvTitleText.setText(getResources().getString(R.string.s_alarm));
        // SmartTabLayout
        FragmentPagerItems.Creator creator = FragmentPagerItems.with(AlarmPromptActivity.this);
        creator.add(getResources().getString(R.string.s_alarm_tab_title1), AlarmFragment.class, new Bundler().putInt("type", 1).get());
        creator.add(getResources().getString(R.string.s_alarm_tab_title2), AlarmFragment.class, new Bundler().putInt("type", 2).get());

        mVpPager.setAdapter(new FragmentPagerItemAdapter(getSupportFragmentManager(), creator.create()));
        mTabView.setViewPager(mVpPager);

        mTabView.setOnTabClickListener(new SmartTabLayout.OnTabClickListener() {
            @Override
            public void onTabClicked(int position) {
                int index = position + 1001;
                Log.e(">>>", "-----点击" + index + "||" + position);
                EB.post(new EbData(index));
            }
        });


    }

    @Override
    public void initData() {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

    }

    @Override
    protected void onPause() {
        super.onPause();
    }


    @OnClick({R.id.iv_title_left})
    public void onClick(final View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.iv_title_left:
                finish();
                break;
        }
    }


}
